<%@tag pageEncoding="UTF-8"%>
<%@ attribute name="page" type="com.greenet.companytemplate.common.persistence.Page" required="true"%>
<%--<%@ attribute name="paginationSize" type="java.lang.Integer" required="true"%>--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
    int paginationSize = page.getPageSize();
    int current =  page.getPageNo() ;
    int begin = Math.max(1, current - paginationSize/2);
    int end = Math.min(begin + (paginationSize - 1), page.getTotalPage());
    int totalPage=page.getTotalPage();
    long count=page.getCount();
    request.setAttribute("current", current);
    request.setAttribute("begin", begin);
    request.setAttribute("end", end);
    request.setAttribute("totalPage", totalPage);
    request.setAttribute("count", count);
%>

<div>
	<ul class="pagination pagination-gnc">
         <li class="info"><a href="javascript:;">共${count}条记录，共${totalPage}页</a></li>
		 <% if (!page.isFirstPage()){%>
               	<li><a class="prepage"  href="?pageNo=1&repage=${current}">&lt;&lt;</a></li>
              <%--  <li><a href="?pageNo=${current-1}&repage=${current}">&lt;</a></li>--%>
         <%}else{%>
                <li class="prepage disabled"><a href="javascript:void(0);">&lt;&lt;</a></li>
               <%-- <li class="disabled"><a href="#">&lt;</a></li>--%>
         <%} %>
 
		<c:forEach var="i" begin="${begin}" end="${end}">
            <c:choose>
                <c:when test="${i == current}">
                    <li class="active"><a href="?pageNo=${i}&repage=${current}">${i}</a></li>
                </c:when>
                <c:otherwise>
                    <li><a href="?pageNo=${i}&repage=${current}">${i}</a></li>
                </c:otherwise>
            </c:choose>
        </c:forEach>


        <%--<div>--%>
            <%--<ul class="pagination pagination-gnc">--%>
                <%--<li class="disabled"><a href="#">&lt;&lt;</a></li>--%>
                <%--<li class="disabled"><a href="#">&lt;</a></li>--%>
                <%--<li><a href="?page=1&amp;sortType=&amp;">1</a></li>--%>
                <%--<li class="active"><a href="?page=2&amp;sortType=&amp;">2</a></li>--%>
                <%--<li><a href="?page=3&amp;sortType=&amp;">&gt;</a></li>--%>
                <%--<li><a href="?page=2&amp;sortType=&amp;">&gt;&gt;</a></li>--%>
            <%--</ul>--%>
        <%--</div>--%>

	  
	  	 <% if (!page.isLastPage()){%>
              <%-- 	<li><a href="?pageNo=${current+1}&repage=${current}">&gt;</a></li>--%>
                <li><a class="nextpage"  href="?pageNo=${page.totalPage}&repage=${current}">&gt;&gt;</a></li>
         <%}else{%>
               <%-- <li class="disabled"><a href="#">&gt;</a></li>--%>
                <li class="nextpage disabled"><a href="javascript:void(0);">&gt;&gt;</a></li>
         <%} %>


	</ul>
</div>

